<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="net.sf.ehcache.CacheManager"%>
<%@page import="java.util.List"%>
<%@ include file="/common/taglibs.jsp"%>
<div class="tableList" >
	<table class="list">
		<thead>
			<tr>
				<th>
					缓存名字
				</th>
				<th>
					缓存对象数
				</th>
				<th>
					缓存占用的内存
				</th>
				<th>
					命中
				</th>
				<th>
					未命中
				</th>
				<th>
					命中率
				</th>
			</tr>
		</thead>
		<tbody>
			<%
				List<CacheManager> cms = CacheManager.ALL_CACHE_MANAGERS;
				for (CacheManager cm : cms) {
					if (cm != null) {
						String[] cacheNames = cm.getCacheNames();
						for (String cacheName : cacheNames) {
							net.sf.ehcache.Cache c = cm.getCache(cacheName);
							long size = c.getSize();
							long storeSize = c.getMemoryStoreSize();
							long hits = c.getStatistics().getCacheHits();
							long miss = c.getStatistics().getCacheMisses();
							double lu = 100 * hits / (hits + miss + 1);
							out.println("<tr><td>" + cacheName + "</td>" + "<td>"
									+ size + "</td>" + "<td>" + storeSize + "</td>"
									+ "<td>" + hits + "</td>" + "<td>" + miss
									+ "<td>" + lu + "%</td>" + "</td></tr>");

						}
					}
				}
			%>
		</tbody>
	</table>
</div>